Skip to content

feat(api): make function call output call IDs optional - #539

Merged
apcha-oai merged 1 commit into
mainfrom
castiron/promotions/pr-56
Aug 27, 2026
Merged

feat(api): make function call output call IDs optional#539
apcha-oai merged 1 commit into
mainfrom
castiron/promotions/pr-56

Conversation

@apcha-oai

Copy link
Copy Markdown
Contributor

Summary

Align function call output types with the API schema: call_id is optional in stable and beta input and response types, and input types also accept null.

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Castiron custom code

Mixed files: 47 → 50

3 newly customized · 0 customizations removed · 0 existing customizations changed · 6 generated baselines changed

Compared 53ccf39b464decbd49b67154. Generated baselines verified.

File Result Current custom patch
lib/openai/resources/beta/responses.rb Generated baseline changed +2 / −2
lib/openai/resources/responses.rb Generated baseline changed +165 / −5
rbi/openai/resources/beta/responses.rbi Generated baseline changed +10 / −2
rbi/openai/resources/responses.rbi Generated baseline changed +284 / −18
sig/openai/resources/beta/responses.rbs Generated baseline changed +4 / −2
sig/openai/resources/responses.rbs Generated baseline changed +33 / −2
44 existing customizations unchanged
  • lib/openai.rb
  • lib/openai/client.rb
  • lib/openai/models/chat/chat_completion_message.rb
  • lib/openai/models/chat/chat_completion_message_function_tool_call.rb
  • lib/openai/models/chat/completion_create_params.rb
  • lib/openai/models/response_format_json_schema.rb
  • lib/openai/models/responses/function_tool.rb
  • lib/openai/models/responses/response.rb
  • lib/openai/models/responses/response_create_params.rb
  • lib/openai/models/responses/response_format_text_config.rb
  • lib/openai/models/responses/response_format_text_json_schema_config.rb
  • lib/openai/models/responses/response_function_tool_call.rb
  • lib/openai/models/responses/response_function_web_search.rb
  • lib/openai/models/responses/response_output_text.rb
  • lib/openai/models/responses/tool.rb
  • lib/openai/resources/beta/threads.rb
  • lib/openai/resources/chat/completions.rb
  • lib/openai/resources/files.rb
  • lib/openai/resources/vector_stores/file_batches.rb
  • lib/openai/resources/vector_stores/files.rb
  • lib/openai/resources/webhooks.rb
  • rbi/openai/client.rbi
  • rbi/openai/models/chat/chat_completion_message.rbi
  • rbi/openai/models/chat/chat_completion_message_function_tool_call.rbi
  • rbi/openai/models/chat/completion_create_params.rbi
  • rbi/openai/models/response_format_json_schema.rbi
  • rbi/openai/models/responses/response.rbi
  • rbi/openai/models/responses/response_create_params.rbi
  • rbi/openai/models/responses/response_function_tool_call.rbi
  • rbi/openai/models/responses/response_function_web_search.rbi
  • rbi/openai/models/responses/response_output_text.rbi
  • rbi/openai/resources/chat/completions.rbi
  • rbi/openai/resources/files.rbi
  • rbi/openai/resources/vector_stores/file_batches.rbi
  • rbi/openai/resources/vector_stores/files.rbi
  • scripts/castiron/README.md
  • scripts/castiron/custom_code_report.py
  • scripts/castiron/test_custom_code_report.py
  • sig/openai/client.rbs
  • sig/openai/models/responses/response.rbs

4 more in the full report.

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download the exact patch produced by this run (requires repository access):

gh run download 33082176846 --repo openai/openai-ruby \
  --name castiron-custom-code-33082176846-1 --dir /tmp/castiron-custom-code-33082176846-1
git apply --stat /tmp/castiron-custom-code-33082176846-1/custom-code.patch
cat /tmp/castiron-custom-code-33082176846-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin 53ccf39b464d8b2052456fa78aaea4dcdee8158c ecbd49b67154aa0a90709dec5bd0d1f87bf20fa6
python3 scripts/castiron/custom_code_report.py report \
  --base 53ccf39b464d8b2052456fa78aaea4dcdee8158c \
  --head ecbd49b67154aa0a90709dec5bd0d1f87bf20fa6 --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-ecbd49b67154
cat /tmp/castiron-custom-code-ecbd49b67154/custom-code.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

@apcha-oai
apcha-oai marked this pull request as ready for review August 26, 2026 23:17
@apcha-oai
apcha-oai requested a review from a team as a code owner August 26, 2026 23:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-27T14:26:54.935737Z ecbd49b New commits
🔒 Security Review Completed 2026-08-27T14:28:17.832654Z ecbd49b New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openai-sdks

openai-sdks Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

OkTest Summary

237/237 SDK tests passed in 9.301s for Ruby SDK PR #539.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 144ms
tests/chat-completions-create.test.ts ✅ Passed 194ms
tests/chat-completions-stream.test.ts ✅ Passed 113ms
tests/files-content-binary.test.ts ✅ Passed 128ms
tests/files-create-multipart.test.ts ✅ Passed 155ms
tests/files-list-pagination.test.ts ✅ Passed 142ms
tests/initialize-config.test.ts ✅ Passed 169ms
tests/instance-isolation.test.ts ✅ Passed 217ms
tests/models-list.test.ts ✅ Passed 146ms
tests/responses-background-lifecycle.test.ts ✅ Passed 207ms
tests/responses-body-method-errors.test.ts ✅ Passed 444ms
tests/responses-cancel-timeout.test.ts ✅ Passed 224ms
tests/responses-cancel.test.ts ✅ Passed 207ms
tests/responses-compact-retries.test.ts ✅ Passed 293ms
tests/responses-compact.test.ts ✅ Passed 371ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 165ms
tests/responses-create-advanced.test.ts ✅ Passed 172ms
tests/responses-create-disconnect.test.ts ✅ Passed 1.089s
tests/responses-create-errors.test.ts ✅ Passed 308ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 172ms
tests/responses-create-retries.test.ts ✅ Passed 295ms
tests/responses-create-stream-failures.test.ts ✅ Passed 119ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 202ms
tests/responses-create-stream-wire.test.ts ✅ Passed 2.097s
tests/responses-create-stream.test.ts ✅ Passed 140ms
tests/responses-create-terminal-states.test.ts ✅ Passed 254ms
tests/responses-create-timeout.test.ts ✅ Passed 247ms
tests/responses-create.test.ts ✅ Passed 223ms
tests/responses-delete.test.ts ✅ Passed 209ms
tests/responses-input-items-errors.test.ts ✅ Passed 167ms
tests/responses-input-items-list.test.ts ✅ Passed 154ms
tests/responses-input-items-options.test.ts ✅ Passed 194ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 290ms
tests/responses-input-tokens-count.test.ts ✅ Passed 192ms
tests/responses-malformed-inputs.test.ts ✅ Passed 1.696s
tests/responses-not-found-errors.test.ts ✅ Passed 298ms
tests/responses-parse.test.ts ✅ Passed 145ms
tests/responses-retrieve-retries.test.ts ✅ Passed 305ms
tests/responses-retrieve.test.ts ✅ Passed 131ms
tests/responses-stored-method-errors.test.ts ✅ Passed 1.023s
tests/retry-behavior.test.ts ✅ Passed 3.018s
tests/sdk-error-shape.test.ts ✅ Passed 551ms

View OkTest run #33082150895

SDK merge (d3dff12379f5) · head (ecbd49b67154) · base (53ccf39b464d) · OkTest (2b1bdfd25e98)

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The newly optional output call_id is correctly omitted at runtime, but the generated public Sorbet/RBS to_hash contracts still guarantee a required non-null call_id. Update the stable and beta generated hash shapes to accurately model omission and add a focused omitted-output regression.

output: OpenAI::Responses::ResponseFunctionToolCallOutputItem::Output::Variants,
status: OpenAI::Responses::ResponseFunctionToolCallOutputItem::Status::TaggedSymbol,
type: Symbol,
call_id: String,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Make the generated output hash contract reflect omitted call_id

This PR makes response-output call_id optional, and BaseModel skips an absent optional field when populating @data; to_hash returns that data without a :call_id entry. However, this changed RBI still declares the returned hash has a required call_id: String, and the matching RBS and beta signatures make the same promise. Consequently model.to_hash.fetch(:call_id) type-checks but raises KeyError for the newly supported valid response. Generate an accurately optional hash key (and matching RBS/beta contracts) and add a focused regression for an output with no call ID.

@apcha-oai apcha-oai Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm this looks like a longstanding issue with the generated RBI code will add a backlog issue for this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Castiron-Internal-PR: openai/openai-ruby-internal#56
Castiron-Source-SHA: a2a75208f6680794a34b23543689d7bf883f04c9
Castiron-Public-Base-SHA: 53ccf39
@apcha-oai
apcha-oai force-pushed the castiron/promotions/pr-56 branch from 2ba4595 to ecbd49b Compare August 27, 2026 14:25
@apcha-oai
apcha-oai enabled auto-merge August 27, 2026 14:27
@apcha-oai
apcha-oai disabled auto-merge August 27, 2026 14:27
@apcha-oai
apcha-oai merged commit 81d385b into main Aug 27, 2026
19 checks passed
@apcha-oai
apcha-oai deleted the castiron/promotions/pr-56 branch August 27, 2026 14:27
@openai-sdks openai-sdks Bot mentioned this pull request Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants